package com.joysuch.wwyt.bp.service.impl.script

import cn.hutool.http.HttpRequest
import com.joysuch.wwyt.bp.entity.BpInspection
import com.joysuch.wwyt.core.support.Context

String execute(BpInspection vo) {
    String appid = "mvAmIwYJ7x6y0EADQvUb"
    String signature = "30ca19ac3d133b30b9243ed61646136f7818a3d85e6a70a3bfaa68d3d64566c3"
    String wfUrl = "http://127.0.0.1:8886"
    Long tenantId = Context.currentTenantId
    String orgCode = Context.currentOrgCode
    Long userId = Context.currentUserId
    String userName = Context.getCurrentUser().getUsername()

    String result = HttpRequest.post(wfUrl + "/api/blade-workflow/process/deleteProcessInstance")
            .body("{\"processInstanceId\":\"" + vo.getHiddenDangerWfid() + "\"}")
            .header("app-id", appid)
            .header("signature", signature)
            .header("tenant-id", tenantId.toString())
            .header("org-code", orgCode)
            .header("user-id", userId.toString())
            .header("user-name", userName)
            .timeout(10000)
            .execute()
            .body()

    return result
}